using System;
using Oracle.ManagedDataAccess.Client;

namespace OracleInternal.Sharding
{
	internal class SubKeyMetadata : IComparable<SubKeyMetadata>
	{
		internal int ColIndex
		{
			get;
			set;
		}

		internal OracleDbType DataType
		{
			get;
			set;
		}

		internal int CharSet
		{
			get;
			set;
		}

		internal SubKeyMetadata(int index, OracleDbType dataType, int charSet)
		{
			ColIndex = index;
			DataType = dataType;
			CharSet = charSet;
		}

		public int CompareTo(SubKeyMetadata o)
		{
			if (this == o)
			{
				return 0;
			}
			if (ColIndex == o.ColIndex)
			{
				throw new ArgumentException(OracleStringResourceManager.GetErrorMesg(ResourceStringConstants.SHARDING_INVALID_TOPOLOGY));
			}
			if (ColIndex < o.ColIndex)
			{
				return -1;
			}
			return 1;
		}
	}
}
